package jsd2302.src.io;

import java.io.*;
import java.nio.charset.StandardCharsets;

/**
 * 缓冲字符流--------最常用的读字符串的流
 * 是一对高级流，并且是字符流
 * 内部维护一个默认kb长度的char数组，还是以块读写形式来读写字符以提高读写效率
 * PrintWrite:按行写入数据
 */
public class PWDemo {
    public static void main(String[] args) throws IOException {

        PrintWriter pw=new PrintWriter("pw.txt");
        pw.println("优酸乳");
        pw.println("优酸乳");
        pw.println("优酸乳");
        pw.close();

        /*
        FileOutputStream fos=new FileOutputStream("pw.txt");//低级流
        OutputStreamWriter osw=new OutputStreamWriter(fos, StandardCharsets.UTF_8);//转换流
        BufferedWriter bw=new BufferedWriter(osw);//缓冲流
        bw.write("优酸乳");
        bw.write("成都");
        bw.close();

         */

    }
}
